document.addEventListener("appMobi.camera.picture.add",onSuccess); 
document.addEventListener("appMobi.camera.picture.busy",onSuccess); 
document.addEventListener("appMobi.camera.picture.cancel",onSuccess); 

function capturePhoto() {
	AppMobi.camera.takePicture(50,false,"jpg");
}

function onSuccess(evt) {

	if (evt.success == true){
		// create image 
		var image = document.createElement('img');
		image.src=AppMobi.camera.getPictureURL(evt.filename);
		image.id=evt.filename;
		document.body.appendChild(image);
	}
	else{
		if (evt.message != undefined){
			alert(evt.message);
		}
	    else{
	        alert("error capturing picture");
	    }
	}
}

// put a button or input like this in html codes - <button id="takepic" style="width:460px;" onclick="capturePhoto()">Take a Picture</button>